﻿using J.Model;
using J.ProductSet.Application.Command.ReleaseAppointmentCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;

namespace J.ProductSet.Controllers
{
    /// <summary>
    /// 发布预约(写)
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ReleaseAppointmentController : ControllerBase
    {
        private readonly IMediator _mediator;
        public ReleaseAppointmentController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 发布预约添加
        /// </summary>
        /// <param name="Release"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> ReleaseAppointmentPost(ReleaseAppointmentPostCommand command)
        {
            return Ok(await _mediator.Send(command));
        }
        /// <summary>
        /// 发布预约删除
        /// </summary>
        /// <param name="ReservationID"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> ReleaseAppointmentDelete(ReleaseAppointmentDeleteCommand command)
        {
            return Ok(await _mediator.Send(command));
        }
        /// <summary>
        /// 发布预约修改
        /// </summary>
        /// <param name="Release"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> ReleaseAppointmentUpdate(ReleaseAppointmentUpdateCommand command)
        {
            return Ok(await _mediator.Send(command));
        }
    }
}
